import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:chewie/chewie.dart';
class VideoPlayPage extends StatefulWidget {
  VideoPlayPage({Key key}) : super(key: key);

  @override
  _VideoPlayPageState createState() => _VideoPlayPageState();
}

class _VideoPlayPageState extends State<VideoPlayPage> {

  VideoPlayerController videoPlayerController;
  ChewieController chewieController ;

  @override
  void initState() {
    super.initState();
    videoPlayerController = VideoPlayerController.network('https://static.apyfc.com//short_video_20191014101557359.mp4');
    chewieController= ChewieController(
        autoInitialize:true,
        videoPlayerController: videoPlayerController,
        aspectRatio: 2 /3,
        autoPlay: false,
        looping: false,
    );
  }
  @override
  void dispose() {
    videoPlayerController.dispose();
    chewieController.dispose();
    super.dispose();
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("视频播放"),
      ),
      body: Center(
        child: Chewie(
          controller: chewieController,
        ),
      ),
    );
  }
}
